package com.pingguopifa.service;

import org.apache.log4j.Logger;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

public class UserDetailServiceImpl implements UserDetailsService{
	
	private final static Logger LOGGER = Logger.getLogger(UserDetailServiceImpl.class);

	private transient UserService userService;
	@Override
	public UserDetails loadUserByUsername(String userName) throws UsernameNotFoundException {
		UserDetails userByUserName = userService.loadUserByUsername(userName);
		LOGGER.debug("username: " + userName + " usernameFromDB: " + userByUserName.getUsername());
		return userByUserName;
	}
	public void setUserService(UserService userService) {
		this.userService = userService;
	}

}
